const utils={
  toast(title= '数据加载失败...'){
    wx.showToast({
      title,
      mask:true,
      icon:'none'
    })
  },
  // 2. 根据时间戳格式化日期
  formatDate(timeStamp) {
    const date = new Date(timeStamp)
    const year = date.getFullYear()
    const month = date.getMonth() + 1
    const day = date.getDate()
    return [year, month, day].map(this.formatNumber).join('/')
  },
  formatNumber(n) {
    const s = n.toString()
    return s[1] ? s : '0' + s
  },
}
wx.utils=utils
export default utils